﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Rotempco.BaseClass.Logic;
using Rotempco.Core.ORM.Managers;
using Rotempco.BaseClass.Objects.AttributeStoreObjects;

namespace Rotempco.BaseClass.Managers
{
    public class PasswordSettingManager
    {
        public PasswordSetting GetPasswordSettings()
        {
            PasswordSetting passwordSettings = Factory.SiteAttributeStore.Get<PasswordSetting>();

            if (passwordSettings == null)
            {
                passwordSettings = new PasswordSetting()
                {
                    MinimumPasswordLength = 3,
                    NumberOfFailedLoginRequests = 10,
                    PasswordMustContainCapitalLetter = false,
                    PasswordMustContainDigit = false,
                    PauseMinutesAfterNumberOfFailedLogins = 3
                };
            }

            return passwordSettings;
        }

        public void SetPasswordSettings(PasswordSetting passwordSettings)
        {
            Factory.SiteAttributeStore.WriteToDB<PasswordSetting>(passwordSettings);
        }
    }
}
